<?php

class Database {
	protected $host;
	protected $username;
	protected $password;
	protected $dbname;
	protected $link;
	public $debug = false;
	protected $lastSql = "";

	public function __construct($host, $username, $password, $dbname, $pconnect, $debug = false) {
		$this->host = $host;
		$this->username = $username;
		$this->password = $password;
		$this->dbname = $dbname;
		$this->pconnect = $pconnect;
		$this->link = null;
		$this->debug = $debug;
			
		if ( !$this->connect($pconnect) ) {
			log(__FILE__.__LINE__."database connect failed");
			exit("");
		}
	}

	// 还存在多次释放的问题
	public function __destruct() {
		@$this->close();
	}

	public function connnect(){}
	public function quoteInfo($sql){}
	public function query($sql){}
	public function fetch_array($id){}
	public function affected_rows(){}
	public function insertId(){}
	public function close(){}
	public function fetchAll($sql){}
	public function assocAll($sql){}
	public function assoc_array($cid){}
	protected  function log($str){}
	public function lastSql() {
		return $this->lastSql;
	}
}